package middle;

import com.eclipsesource.json.Json;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * 784. 字母大小写全排列
 */
public class LetterCasePermutation {

    public static String stringToString(String input) {
        if (input == null) {
            return "null";
        }
        return input;
    }

    public static String stringListToString(List<String> stringList) {
        StringBuilder sb = new StringBuilder("[");
        for (String item : stringList) {
            sb.append(item);
            sb.append(",");
        }

        sb.setCharAt(sb.length() - 1, ']');
        return sb.toString();
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = in.readLine()) != null) {
            String s = stringToString(line);

            List<String> ret = new Solution().letterCasePermutation(s);

            String out = stringListToString(ret);

            System.out.print(out);
        }
    }

    static class Solution {
        public List<String> letterCasePermutation(String s) {
            List<String> ans = new ArrayList<>();
            int len = s.length();
            dfs(s, 0, len, "", ans);
            return ans;
        }

        private void dfs(String s, int index, int len, String currStr, List<String> ans) {
            if (index == len) {
                ans.add(currStr);
                return;
            }
            if (Character.isDigit(s.charAt(index))) {
                dfs(s, index + 1, len, currStr + s.charAt(index), ans);
            } else {
                dfs(s, index + 1, len, currStr + s.charAt(index), ans);
                if (Character.isLowerCase(s.charAt(index))) {
                    dfs(s, index + 1, len, currStr + Character.toUpperCase(s.charAt(index)), ans);
                } else {
                    dfs(s, index + 1, len, currStr + Character.toLowerCase(s.charAt(index)), ans);
                }
            }
        }
    }
}
